import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    showAppLoading: false,
    showErr: '',
  },
  getters: { // 暴露值到外部
    showAppLoading : state => state.showAppLoading,
    showErr : state => state.showErr,
  },
  actions: {
    upstate({commit},keyval){
      commit('UPSTATE',keyval)
    },
  },
  mutations: {
    //修改功能
    UPSTATE(state,keyval){
      state[keyval.key] = keyval.val
    },
  },
})
